# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-odfpy
pkgname=('python2-odfpy' 'python-odfpy')
_pkgname=odfpy
pkgver=1.4.1
pkgrel=6
pkgdesc='A complete API for OpenDocument in Python. Python 2.x support.'
arch=('any')
url='https://pypi.org/project/odfpy/'
license=('Apache')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('576b0eba9bba15d3682b1d0c33c585d02abb0cf9a11b783bc17d5e870ff779749d78d60b3b71d274e3195eed23ba687358d5df39e3fedec4b265b46a270f2fe1')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-odfpy() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-odfpy() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

